import Api from '@/service/api/api';
import { getServiceBaseURL } from '@/utils/service';
import { request } from '../request';

const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y';
const { baseURL, otherBaseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);

/**
 * 获取检查内容
 */
export function getCheckContentListAction() {
  return request<any>({
    url: Api.CheckContentList,
    method: 'get'
  });
}

/**
 * 文件格式转换（doc、pdf文件转docx文件）
 *
 * @param params
 */
export function uploadDocument2DocxAction(params: any) {
  return request<any>({
    baseURL: otherBaseURL.bidWrite,
    url: Api.Document2docx,
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: params
  });
}

/**
 * 文件格式转换（doc、pdf文件转docx文件）
 *
 * @param params
 */
export function uploadDocument2DocxNewAction(params: any) {
  return request<any>({
    baseURL: otherBaseURL.bidWrite,
    url: Api.NewDocument2docx,
    method: 'post',
    data: params
  });
}

/**
 * 火眼金睛上传文件
 *
 * @param params
 */
export function uploadCompareFileAction(params: any) {
  return request<any>({
    url: Api.UploadCompareFile,
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: params
  });
}

/**
 * 新增比对记录
 *
 * @param params
 */
export function bidCompareInsertAction(params: any) {
  return request<any>({
    url: Api.BidCompareInsert,
    method: 'post',
    data: params
  });
}

/**
 * 开始比对
 *
 * @param params
 */
export function documentRunFunctionsAction(params: any) {
  return request<any>({
    baseURL: otherBaseURL.bidWrite,
    url: Api.RunFunctions,
    method: 'post',
    data: params
  });
}

/**
 * 记录投标单位
 *
 * @param params
 */
export function bidCompareInsertUnitAction(params: any) {
  return request<any>({
    url: Api.InsertUnit,
    method: 'post',
    data: params
  });
}

/**
 * 记录比对结果
 *
 * @param params
 */
export function insertCompareContentAction(params: any) {
  return request<any>({
    url: Api.InsertCompareContent,
    method: 'post',
    data: params
  });
}

/**
 * 获取检查内容
 *
 * @param params
 */
export function getBidCompareUnitAction(params: any) {
  return request<any>({
    url: Api.QueryCompareList,
    method: 'get',
    params
  });
}
